<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>订餐系统-后台管理</title>
    <link rel="stylesheet" href="/public/admin/assets/css/public.css">
    <link rel="stylesheet" href="/public/admin/assets/css/login.css">
</head>
<body>
    <table class="login-table">
        <tr>
            <td>
                <div class="login-box">
                    <img src="/public/admin/assets/images/logo.png" alt="">
                    <p class="login-title">齐装网点餐系统</p>
                    <b id='msg'></b>
                    <div class="line-box">
                        <label for="">账号 : </label>
                        <input type="text" class="countId" name="countId" id='count'>
                    </div>
                    <div class="line-box">
                        <label for="">密码 : </label>
                        <input type="password" class="password" name="password">

                    </div>
                    <div class="line-box">
                        <label for="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </label>
                        <button class="button button-login">登录</button>
                    </div>
                </div>
            </td>
        </tr>
    </table>
</body>
<script src='/public/admin/assets/js/jquery.min.js'></script>
<script>
$(function() {
    // 登陆验证
    $('button').click(function(){
        var count = $('.countId').val()
        var pass = $('.password').val()
        if(count == '') {
            $('#msg').html('帐号不能为空')
            return
        }
        if(pass == '') {
            $('#msg').html('密码不能为空')
            return
        }
        $.ajax({
            url:"{:U('/admin/public/login')}",
            type: 'post',
            data: {'username':count, 'userpass': pass},
            success:function(json) {
                if(json.status == '0'){
                    window.location.href = json.url
                }else{
                    var html = json.msg
                    $('#msg').html(html);
                }
            }
        })
    })
})
</script>
</html>